package com.glorious.controller;

import com.glorious.common.Result;
import com.glorious.entities.OauthClientDetails;
import com.glorious.service.IOauthClientDetailsService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/client/oauth-clients")
public class OauthClientDetailsController {

    @Autowired
    private IOauthClientDetailsService iOauthClientDetailsService;

    @ApiOperation(value = "客户端详情")
    @ApiImplicitParam(name = "clientId", value = "客户端id", required = true, paramType = "path", dataType = "String")
    @GetMapping("/{clientId}")
    public Result<OauthClientDetails> detail(@PathVariable String clientId) {
        OauthClientDetails client = iOauthClientDetailsService.getById(clientId);
        return Result.success(client);
    }
}
